﻿using UnityEngine;
using UnityEngine.UI;

namespace Learning.Spine
{
    public class SpineTestScript : MonoBehaviour
    {
        public Transform uiSpineRoot;
        
        public RawImage edgeSpineImage;
        
        private void Awake()
        {
            EdgeSpineUtil.Init();
        }
        
        public void LoadUISpine()
        {
            UISpineUtil.LoadSpine("Assets/Spine/Runtime/Res/UIPrefab/10116_spine.prefab", uiSpineRoot, "idle", go =>
            {
                var trans = go.GetComponent<RectTransform>();
                trans.anchoredPosition = new Vector2(0, -100);
            });
        }

        public void LoadEdgeSpine()
        {
            EdgeSpineUtil.LoadSpine("Assets/Spine/Runtime/Res/Prefab/10062_spine.prefab", edgeSpineImage, "idle");
        }
    }
}
